#!/bin/bash

#author:cali
#time:2020-49
#company:sanchuang
#email:695811769@qq.com

mkdir -p /nginx2
cd /nginx2
#download nginx
curl -O http://nginx.org/download/nginx-1.17.9.tar.gz

#解压
tar xf nginx-1.17.9.tar.gz 

#进入解压目录
cd nginx-1.17.9

#解决依赖关系
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel gcc gcc-c++ autoconf automake make 

#配置
./configure  --prefix=/usr/local/nginx9  --user=lihu --group=lihu --with-threads  --with-file-aio  --with-http_ssl_module  --with-http_stub_status_module  --with-stream 

#编译和安装
make -j 2 ; make install

#开机启动
echo "/usr/local/nginx9/sbin/nginx" >>/etc/rc.local 
chmod +x /etc/rc.d/rc.local 

#修改PATH变量
echo "PATH=/usr/local/nginx9/sbin:$PATH" >>/etc/profile
PATH=/usr/local/nginx9/sbin:$PATH
#启动

nginx

